package com.joysuch.wwyt.workflow.repository;

import com.joysuch.wwyt.workflow.entity.WorkFlowBizType;
import com.joysuch.wwyt.workflow.entity.WorkFlowFormTemplateType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface WorkFlowBizTypeDao extends JpaRepository<WorkFlowBizType, Long>{

    WorkFlowBizType findFirstByNameAndParentIdAndProcessId(String name, Long parentId, Long processId);

    @Query(value = "select * from wwyt_workflow_biz_type where delete_flag = '0'and (process_id =?1 or process_id is null )and state=1 order by parent_id, show_order asc ", nativeQuery = true)
    List<WorkFlowBizType> findAllByState(Long processId);


}
